<extend name="Layout/index" />
<block name="breadcrumb-01">
	<li>
		<i class="icon-home home-icon"></i>
		<a href="#">首页</a>
	</li>
	<li class="active">广告管理</li>
</block>

<block name="breadcrumb-02">
	<h1>
		广告管理
		<small>
			<i class="icon-double-angle-right"></i>
			 广告列表
		</small>
	</h1>
</block>
<block name="main">
	
		<table class="table table-striped table-bordered table-hover">
			<thead>
				<tr align='left' bgcolor="#ccc">
					<th>ID</th>
					<th>广告名</th>
					<th>地址</th>
					<th>图片</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
			<volist name="data" id="vo">
				<tr>
					<td><{$vo.id}></td>
					<td><{$vo.name}></td>
					<td><{$vo.url}></td>
					<td><img src="__UPLOAD__/<{$vo.photo}>" alt="" width=150 height=100></td>
					<td>
						<input type="hidden" value="<{$vo.id}>">
						<a href="" class="del">删除</a>
						<a href="<{:U('Ad/edit',array('id'=>$vo['id']))}>">修改</a>
					</td>
				</tr>
			</volist>
			</tbody>
			
			
		</table>
		<script src="__PUBLIC__/jq/jquery-3.0.0.min.js"></script>
		<script>
		$(function(){
			$('.del').click(function(){
				var _this = $(this);
        		var id=$(this).prev().val();
				$.ajax({
					url:"<{:U('Ad/delajax')}>",
					type:'post',
					dataType:'json',
					data:'id='+id,
					success:function(data){
						if(data){
							_this.parent().parent().remove();
						}else{
							alert('删除失败');
						}
					}
				})
				return false;
			})
		})
		</script>
	
</block>